#include "Graphics/VertexElement.h"

namespace tyro
{
	namespace Graphics
	{
		size_t VertexElement::GetTypeSize( VertexElementType vetype )
		{
			switch(vetype)
			{
			case VET_COLOUR:
			case VET_COLOUR_ABGR:
			case VET_COLOUR_ARGB:
				return sizeof(RGBA);
			case VET_FLOAT1:
				return sizeof(float);
			case VET_FLOAT2:
				return sizeof(float)*2;
			case VET_FLOAT3:
				return sizeof(float)*3;
			case VET_FLOAT4:
				return sizeof(float)*4;
			case VET_SHORT1:
				return sizeof(short);
			case VET_SHORT2:
				return sizeof(short)*2;
			case VET_SHORT3:
				return sizeof(short)*3;
			case VET_SHORT4:
				return sizeof(short)*4;
			case VET_UBYTE4:
				return sizeof(unsigned char)*4;
			}
			return 0;
		}

		tyro::USHORT_16 VertexElement::GetTypeCount( VertexElementType vetype )
		{
			switch (vetype)
			{
			case VET_COLOUR:
			case VET_COLOUR_ABGR:
			case VET_COLOUR_ARGB:
				return 1;
			case VET_FLOAT1:
				return 1;
			case VET_FLOAT2:
				return 2;
			case VET_FLOAT3:
				return 3;
			case VET_FLOAT4:
				return 4;
			case VET_SHORT1:
				return 1;
			case VET_SHORT2:
				return 2;
			case VET_SHORT3:
				return 3;
			case VET_SHORT4:
				return 4;
			case VET_UBYTE4:
				return 4;
			}
		}

		VertexElement::VertexElement( UINT_32 source, size_t memOffset, VertexElementType type, VertexElementSemantic semantic, UINT_32 index /*= 0*/ )
			: source(source)
			, memOffset(memOffset)
			, type(type)
			, semantic(semantic)
			, index(index)
		{

		}

		tyro::VertexElementSemantic VertexElement::GetSemantic( void ) const
		{
			return semantic;
		}

		tyro::VertexElementType VertexElement::GetType( void ) const
		{
			return type;
		}

		tyro::UINT_32 VertexElement::GetSource( void ) const
		{
			return source;
		}

		

		

	}
}
